public class E3 {
    public static void main(String[] args) {
        double sum=0,a=1,i=1;
        do {
            sum=sum+a;
            i++;
            a=(1.0/i)*a;
        }while (i<=20);
        System.out.println("Do while结果是："+sum);
        double sum2=0,b=1,j=1;
        for (j=1;j<=20;j++){
            b=(1.0/j)*b;
            sum2=sum2+b;
        }
        System.out.println("For结果是："+sum2);
    }
}
